home *** CD-ROM | disk | FTP | other *** search
- unit aplibu;
-
- (*
- * aPLib compression library - the smaller the better :)
- *
- * TMT Pascal interface to aPLib Delphi objects
- *
- * Copyright (c) 1998-2000 by Joergen Ibsen / Jibz
- * All Rights Reserved
- *
- * -> VPascal by Veit Kannegieser, 23.09.1998
- * -> TMT Pascal by Oleg Prokhorov
- *)
-
- interface
-
- const
- aP_pack_continue=1;
- aP_pack_break =0;
-
- type
- workmem_type=array[0..640*1024-1] of byte;
-
- (* if you want abort compression with Esc uncomment following line *)
- (*uses crt; *)
-
- function aP_pack(var quelle;
- var ziel;
- laenge:longint;
- var workmem:workmem_type;
- status:pointer):longint;
-
- function aP_depack_asm(var quelle,ziel):longint;
-
- function aP_depack_asm_fast(var quelle,ziel):longint;
-
- function cb0:longint;
- function cb1:longint;
-
- implementation
-
- function _aP_pack:longint;external;
-
- function _aP_workmem_size:longint;external;
-
- function _aP_depack_asm:longint;external;
-
- function _aP_depack_asm_fast:longint;external;
-
- (*$l ..\..\lib\delphi\depack.obj *)
- (*$l ..\..\lib\delphi\depackf.obj *)
- (*$l ..\..\lib\delphi\aplib.obj *)
-
- function aP_pack(var quelle;
- var ziel;
- laenge:longint;
- var workmem:workmem_type;
- status:pointer):longint;assembler;
- asm
- push status
- push workmem
- push laenge
- push ziel
- push quelle
- call _aP_pack
- end;
-
- function aP_workmem_size(laenge:longint):longint;assembler;
- asm
- push laenge
- call _aP_workmem_size
- end;
-
- function aP_depack_asm(var quelle,ziel):longint;assembler;
- asm
- push ziel
- push quelle
- call _aP_depack_asm
- end;
-
- function aP_depack_asm_fast(var quelle,ziel):longint;assembler;
- asm
- push ziel
- push quelle
- call _aP_depack_asm_fast
- end;
-
- (* callback samples for _aP_pack *)
-
- function cb0:longint;assembler;
- asm
- mov eax,aP_pack_continue
- end;
-
- function cb1_(w1,w2:longint):longint;
- begin
- write(w1:8,w2:8,^m);
- cb1_:=aP_pack_continue;
- (* if you want abort compression with Esc uncomment following line *)
- (*if keypressed then
- if readkey=#27 then
- cb1_:=aP_pack_break; *)
- end;
-
- function cb1:longint;assembler;
- asm
- pushad
- push dword [ebp+08h]
- push dword [ ebp+0Ch]
- call cb1_
- mov [esp+1ch],eax (* POPAD restores EAX *)
- popad
- end;
-
- end.
-